package ru.spb.nicetu.schoolproject;

import ru.spb.nicetu.schoolproject.data.HibernateTblModel;
import ru.spb.nicetu.schoolproject.data.Lesson;

import java.util.List;

/**
 * Created by dchernyshov on 25.04.15.
 */
public class TblModelForLessons extends HibernateTblModel<Lesson> {
    public TblModelForLessons() {
        super(Lesson.class, 4);
    }

    public TblModelForLessons(List<Lesson> lessonList) {
        super(Lesson.class, 12);
        list = lessonList;
    }

    @Override
    public String getColumnName(int columnIndex) {
        switch (columnIndex) {
            case 0:
                return "№ класса";
            case 1:
                return "Предмет";
            case 2:
                return "Учитель";
            case 3:
                return "Номер урока";
            case 4:
                return "День недели";
            default:
                return "";
        }
    }

    @Override
    public int getColumnCount() {
        return 5;
    }

    @Override
    public Object getValueAt(int i, int i1) {
        Lesson lesson = list.get(i);
        switch (i1) {
            case 0:
                return lesson.getClazz().getClassNum();
            case 1:
                return lesson.getSubject().getName().trim();
            case 2:
                return lesson.getTeacher().getTeacherName().trim();
            case 3:
                return lesson.getLessonNum();
            case 4:
                return lesson.getDayOfWeek().getName().trim();
            default:
                return null;
        }
    }
}
